package com.peak.distribution.entity.admin;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.LazyToOne;
import org.hibernate.annotations.LazyToOneOption;

import com.peak.distribution.enums.Constants;
import com.peak.distribution.enums.SmsType;
import com.peak.spring.boot.api.entity.DefaultStategyEntity;

import lombok.Data;
import lombok.EqualsAndHashCode;

@Entity
@Table(name = "dis_sms_log")
@Data
@EqualsAndHashCode(callSuper=true)
public class DisSmsLog extends DefaultStategyEntity {
	
	private static final long serialVersionUID = Constants.DISTRIBUTION_VERSION;
	
	/** 谁发送的 */
	private DisUser from;
	
	/** 发送给那个手机号 */
	private String mobileNos;
	
	/** 发送时间 */
	private Date sendTime;
	
	/** 发送内容 */
	private String content;
	
	/** 发送结果 */
	private String result;
	
	/** 短信类型 */
	private SmsType type;
	
	@ManyToOne
	@JoinColumn(name = "user_id")
	@Fetch(FetchMode.SELECT)
	@LazyToOne(LazyToOneOption.PROXY)
	public DisUser getFrom() {
		return from;
	}
	
	@Enumerated(EnumType.STRING)
	public SmsType getType() {
		return type;
	}

}
